<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AJAX</title>
</head>
<body>
    <p>
        <input type="button" value="发送" onclick="send();">
    </p>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js" crossorigin="anonymous"></script>
    <script>
        function send() {
            $.post(
              "/community/alpha/ajax",
              {"name":"张三", "age":23},
              function (data) {
                  console.log(typeof(data));
                  console.log(data);

                  data1 = JSON.parse(data);
                  console.log(typeof(data1));
                  console.log(data1.code);
                  console.log(data1.msg);

                  data = $.parseJSON(data);
                  console.log(typeof(data));
                  console.log(data.code);
                  console.log(data.msg);
              }
            );
        }
    </script>
</body>
</html>